home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / circuits / irsim-ca.2 / irsim-ca / irsim-cap-9.2 / src / ana11 / namelen.c < prev    next >
C/C++ Source or Header  |  1993-01-15  |  2KB  |  96 lines

  1. /*
  2.  *     ********************************************************************* 
  3.  *     * Copyright (C) 1988, 1990 Stanford University.                     * 
  4.  *     * Permission to use, copy, modify, and distribute this              * 
  5.  *     * software and its documentation for any purpose and without        * 
  6.  *     * fee is hereby granted, provided that the above copyright          * 
  7.  *     * notice appear in all copies.  Stanford University                 * 
  8.  *     * makes no representations about the suitability of this            * 
  9.  *     * software for any purpose.  It is provided "as is" without         * 
  10.  *     * express or implied warranty.  Export of this software outside     * 
  11.  *     * of the United States of America may require an export license.    * 
  12.  *     *********************************************************************
  13.  */
  14.  
  15. #include "ana.h"
  16. #include "ana_glob.h"
  17.  
  18.  
  19. public    int  max_name_len = 15;
  20.  
  21.  
  22. private void GetNameLen( str )
  23.   char  *str;
  24.   {
  25.     Trptr  t;
  26.     int    len, change, wasTooSmall;
  27.  
  28.     if( str == NULL )
  29.       {
  30.     XBell( display, 0 );
  31.     return;
  32.       }
  33.     len = atoi( str );
  34.     if( len < 8 or len > 256 )
  35.       {
  36.     XBell( display, 0 );
  37.     return;
  38.       }
  39.  
  40.     if( len == max_name_len )
  41.     return;
  42.  
  43.     max_name_len = len;
  44.  
  45.     DisableInput();
  46.  
  47.     for( t = traces.first; t != NULL; t = t->next )
  48.       {
  49.     if( t->vector )
  50.         t->name = SetName( t->n.vec->name );
  51.     else
  52.         t->name = SetName( t->n.nd->nname );
  53.     t->len = strlen( t->name );
  54.       }
  55.  
  56.     if( windowState.iconified )
  57.       {
  58.     EnableInput();
  59.     return;
  60.       }
  61.  
  62.     wasTooSmall = windowState.tooSmall;
  63.  
  64.     change = WindowChanges();
  65.     if( windowState.tooSmall )
  66.       {
  67.     RedrawSmallW();
  68.     EnableInput();
  69.     return;
  70.       }
  71.  
  72.     if( change & WIDTH_CHANGE )
  73.       {
  74.     if( wasTooSmall )
  75.       {
  76.         RedrawBanner();
  77.         RedrawText();
  78.         DrawCursVal( cursorBox );
  79.       }
  80.     RedrawNames( namesBox );
  81.     DrawScrollBar( wasTooSmall );
  82.     RedrawTimes();
  83.     DrawTraces( tims.start, tims.end );
  84.       }
  85.  
  86.     EnableInput();
  87.   }
  88.  
  89.  
  90. public void SetNameLen( s )
  91.   char  *s;                /* the menu string => ignore it */
  92.   {
  93.     PRINTF( "\nEnter max. length (%d) > ", max_name_len );
  94.     Query( " > ", GetNameLen );
  95.   }
  96.